\hypertarget{group__comp__api}{
\section{Comp\_\-api}
\label{group__comp__api}\index{Comp\_\-api@{Comp\_\-api}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__comp__api_ga83076c7c7904a1bbc4e335c6b973c090}{ComparatorConfigure} (unsigned long ulBase, unsigned long ulComp, unsigned long ulConfig)
\item 
void \hyperlink{group__comp__api_ga177180b6a424dbc4873aa0cce14a9d41}{ComparatorRefSet} (unsigned long ulBase, unsigned long ulRef)
\item 
tBoolean \hyperlink{group__comp__api_ga38adef6a943761121d8600e2570ed8c6}{ComparatorValueGet} (unsigned long ulBase, unsigned long ulComp)
\item 
void \hyperlink{group__comp__api_gad910c98f7670d27fc17d4113f0c5a249}{ComparatorIntRegister} (unsigned long ulBase, unsigned long ulComp, void($\ast$pfnHandler)(void))
\item 
void \hyperlink{group__comp__api_ga38c2207a32069f123d15250efb7f9e28}{ComparatorIntUnregister} (unsigned long ulBase, unsigned long ulComp)
\item 
void \hyperlink{group__comp__api_ga5a471fc98de196971c601f67a052f788}{ComparatorIntEnable} (unsigned long ulBase, unsigned long ulComp)
\item 
void \hyperlink{group__comp__api_gaddecd3f6152cd5e223013a97e79eea94}{ComparatorIntDisable} (unsigned long ulBase, unsigned long ulComp)
\item 
tBoolean \hyperlink{group__comp__api_gaaaec43c1fbbc2ab07b028238a0a3bbae}{ComparatorIntStatus} (unsigned long ulBase, unsigned long ulComp, tBoolean bMasked)
\item 
void \hyperlink{group__comp__api_ga6aaa870cba41e5fb5e6fa800e5014d57}{ComparatorIntClear} (unsigned long ulBase, unsigned long ulComp)
\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{group__comp__api_ga83076c7c7904a1bbc4e335c6b973c090}{
\index{comp\_\-api@{comp\_\-api}!ComparatorConfigure@{ComparatorConfigure}}
\index{ComparatorConfigure@{ComparatorConfigure}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorConfigure}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorConfigure (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp, }
\item[{unsigned long}]{ ulConfig}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_ga83076c7c7904a1bbc4e335c6b973c090}
Configures a comparator.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator to configure. \item[{\em ulConfig}]is the configuration of the comparator.\end{DoxyParams}
This function will configure a comparator. The {\itshape ulConfig\/} parameter is the result of a logical OR operation between the {\bfseries COMP\_\-TRIG\_\-xxx}, {\bfseries COMP\_\-INT\_\-xxx}, {\bfseries COMP\_\-ASRCP\_\-xxx}, and {\bfseries COMP\_\-OUTPUT\_\-xxx} values.

The {\bfseries COMP\_\-TRIG\_\-xxx} term can take on the following values:


\begin{DoxyItemize}
\item {\bfseries COMP\_\-TRIG\_\-NONE} to have no trigger to the ADC.
\item {\bfseries COMP\_\-TRIG\_\-HIGH} to trigger the ADC when the comparator output is high.
\item {\bfseries COMP\_\-TRIG\_\-LOW} to trigger the ADC when the comparator output is low.
\item {\bfseries COMP\_\-TRIG\_\-FALL} to trigger the ADC when the comparator output goes low.
\item {\bfseries COMP\_\-TRIG\_\-RISE} to trigger the ADC when the comparator output goes high.
\item {\bfseries COMP\_\-TRIG\_\-BOTH} to trigger the ADC when the comparator output goes low or high.
\end{DoxyItemize}

The {\bfseries COMP\_\-INT\_\-xxx} term can take on the following values:


\begin{DoxyItemize}
\item {\bfseries COMP\_\-INT\_\-HIGH} to generate an interrupt when the comparator output is high.
\item {\bfseries COMP\_\-INT\_\-LOW} to generate an interrupt when the comparator output is low.
\item {\bfseries COMP\_\-INT\_\-FALL} to generate an interrupt when the comparator output goes low.
\item {\bfseries COMP\_\-INT\_\-RISE} to generate an interrupt when the comparator output goes high.
\item {\bfseries COMP\_\-INT\_\-BOTH} to generate an interrupt when the comparator output goes low or high.
\end{DoxyItemize}

The {\bfseries COMP\_\-ASRCP\_\-xxx} term can take on the following values:


\begin{DoxyItemize}
\item {\bfseries COMP\_\-ASRCP\_\-PIN} to use the dedicated Comp+ pin as the reference voltage.
\item {\bfseries COMP\_\-ASRCP\_\-PIN0} to use the Comp0+ pin as the reference voltage (this the same as {\bfseries COMP\_\-ASRCP\_\-PIN} for the comparator 0).
\item {\bfseries COMP\_\-ASRCP\_\-REF} to use the internally generated voltage as the reference voltage.
\end{DoxyItemize}

The {\bfseries COMP\_\-OUTPUT\_\-xxx} term can take on the following values:


\begin{DoxyItemize}
\item {\bfseries COMP\_\-OUTPUT\_\-NORMAL} to enable a non-\/inverted output from the comparator to a device pin.
\item {\bfseries COMP\_\-OUTPUT\_\-INVERT} to enable an inverted output from the comparator to a device pin.
\item {\bfseries COMP\_\-OUTPUT\_\-NONE} is deprecated and behaves the same as {\bfseries COMP\_\-OUTPUT\_\-NORMAL}.
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_ga6aaa870cba41e5fb5e6fa800e5014d57}{
\index{comp\_\-api@{comp\_\-api}!ComparatorIntClear@{ComparatorIntClear}}
\index{ComparatorIntClear@{ComparatorIntClear}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorIntClear}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorIntClear (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_ga6aaa870cba41e5fb5e6fa800e5014d57}
Clears a comparator interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator.\end{DoxyParams}
The comparator interrupt is cleared, so that it no longer asserts. This must be done in the interrupt handler to keep it from being called again immediately upon exit. Note that for a level triggered interrupt, the interrupt cannot be cleared until it stops asserting.

\begin{DoxyNote}{Note}
Since there is a write buffer in the Cortex-\/M3 processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (since NVIC still sees the interrupt source asserted).
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_gaddecd3f6152cd5e223013a97e79eea94}{
\index{comp\_\-api@{comp\_\-api}!ComparatorIntDisable@{ComparatorIntDisable}}
\index{ComparatorIntDisable@{ComparatorIntDisable}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorIntDisable}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorIntDisable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_gaddecd3f6152cd5e223013a97e79eea94}
Disables the comparator interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator.\end{DoxyParams}
This function disables generation of an interrupt from the specified comparator. Only comparators whose interrupts are enabled can be reflected to the processor.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_ga5a471fc98de196971c601f67a052f788}{
\index{comp\_\-api@{comp\_\-api}!ComparatorIntEnable@{ComparatorIntEnable}}
\index{ComparatorIntEnable@{ComparatorIntEnable}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorIntEnable}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorIntEnable (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_ga5a471fc98de196971c601f67a052f788}
Enables the comparator interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator.\end{DoxyParams}
This function enables generation of an interrupt from the specified comparator. Only comparators whose interrupts are enabled can be reflected to the processor.

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_gad910c98f7670d27fc17d4113f0c5a249}{
\index{comp\_\-api@{comp\_\-api}!ComparatorIntRegister@{ComparatorIntRegister}}
\index{ComparatorIntRegister@{ComparatorIntRegister}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorIntRegister}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorIntRegister (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp, }
\item[{void($\ast$)(void)}]{ pfnHandler}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_gad910c98f7670d27fc17d4113f0c5a249}
Registers an interrupt handler for the comparator interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator. \item[{\em pfnHandler}]is a pointer to the function to be called when the comparator interrupt occurs.\end{DoxyParams}
This sets the handler to be called when the comparator interrupt occurs. This will enable the interrupt in the interrupt controller; it is the interrupt-\/handler's responsibility to clear the interrupt source via \hyperlink{group__comp__api_ga6aaa870cba41e5fb5e6fa800e5014d57}{ComparatorIntClear()}.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_gaaaec43c1fbbc2ab07b028238a0a3bbae}{
\index{comp\_\-api@{comp\_\-api}!ComparatorIntStatus@{ComparatorIntStatus}}
\index{ComparatorIntStatus@{ComparatorIntStatus}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorIntStatus}]{\setlength{\rightskip}{0pt plus 5cm}tBoolean ComparatorIntStatus (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp, }
\item[{tBoolean}]{ bMasked}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_gaaaec43c1fbbc2ab07b028238a0a3bbae}
Gets the current interrupt status.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator. \item[{\em bMasked}]is {\bfseries false} if the raw interrupt status is required and {\bfseries true} if the masked interrupt status is required.\end{DoxyParams}
This returns the interrupt status for the comparator. Either the raw or the masked interrupt status can be returned.

\begin{DoxyReturn}{Returns}
{\bfseries true} if the interrupt is asserted and {\bfseries false} if it is not asserted. 
\end{DoxyReturn}
\hypertarget{group__comp__api_ga38c2207a32069f123d15250efb7f9e28}{
\index{comp\_\-api@{comp\_\-api}!ComparatorIntUnregister@{ComparatorIntUnregister}}
\index{ComparatorIntUnregister@{ComparatorIntUnregister}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorIntUnregister}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorIntUnregister (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_ga38c2207a32069f123d15250efb7f9e28}
Unregisters an interrupt handler for a comparator interrupt.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator.\end{DoxyParams}
This function will clear the handler to be called when a comparator interrupt occurs. This will also mask off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

\begin{DoxySeeAlso}{See also}
\hyperlink{group__interrupt__api_ga471d00d73ae22faa426c202f608e9c69}{IntRegister()} for important information about registering interrupt handlers.
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_ga177180b6a424dbc4873aa0cce14a9d41}{
\index{comp\_\-api@{comp\_\-api}!ComparatorRefSet@{ComparatorRefSet}}
\index{ComparatorRefSet@{ComparatorRefSet}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorRefSet}]{\setlength{\rightskip}{0pt plus 5cm}void ComparatorRefSet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulRef}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_ga177180b6a424dbc4873aa0cce14a9d41}
Sets the internal reference voltage.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulRef}]is the desired reference voltage.\end{DoxyParams}
This function will set the internal reference voltage value. The voltage is specified as one of the following values:


\begin{DoxyItemize}
\item {\bfseries COMP\_\-REF\_\-OFF} to turn off the reference voltage
\item {\bfseries COMP\_\-REF\_\-0V} to set the reference voltage to 0 V
\item {\bfseries COMP\_\-REF\_\-0\_\-1375V} to set the reference voltage to 0.1375 V
\item {\bfseries COMP\_\-REF\_\-0\_\-275V} to set the reference voltage to 0.275 V
\item {\bfseries COMP\_\-REF\_\-0\_\-4125V} to set the reference voltage to 0.4125 V
\item {\bfseries COMP\_\-REF\_\-0\_\-55V} to set the reference voltage to 0.55 V
\item {\bfseries COMP\_\-REF\_\-0\_\-6875V} to set the reference voltage to 0.6875 V
\item {\bfseries COMP\_\-REF\_\-0\_\-825V} to set the reference voltage to 0.825 V
\item {\bfseries COMP\_\-REF\_\-0\_\-928125V} to set the reference voltage to 0.928125 V
\item {\bfseries COMP\_\-REF\_\-0\_\-9625V} to set the reference voltage to 0.9625 V
\item {\bfseries COMP\_\-REF\_\-1\_\-03125V} to set the reference voltage to 1.03125 V
\item {\bfseries COMP\_\-REF\_\-1\_\-134375V} to set the reference voltage to 1.134375 V
\item {\bfseries COMP\_\-REF\_\-1\_\-1V} to set the reference voltage to 1.1 V
\item {\bfseries COMP\_\-REF\_\-1\_\-2375V} to set the reference voltage to 1.2375 V
\item {\bfseries COMP\_\-REF\_\-1\_\-340625V} to set the reference voltage to 1.340625 V
\item {\bfseries COMP\_\-REF\_\-1\_\-375V} to set the reference voltage to 1.375 V
\item {\bfseries COMP\_\-REF\_\-1\_\-44375V} to set the reference voltage to 1.44375 V
\item {\bfseries COMP\_\-REF\_\-1\_\-5125V} to set the reference voltage to 1.5125 V
\item {\bfseries COMP\_\-REF\_\-1\_\-546875V} to set the reference voltage to 1.546875 V
\item {\bfseries COMP\_\-REF\_\-1\_\-65V} to set the reference voltage to 1.65 V
\item {\bfseries COMP\_\-REF\_\-1\_\-753125V} to set the reference voltage to 1.753125 V
\item {\bfseries COMP\_\-REF\_\-1\_\-7875V} to set the reference voltage to 1.7875 V
\item {\bfseries COMP\_\-REF\_\-1\_\-85625V} to set the reference voltage to 1.85625 V
\item {\bfseries COMP\_\-REF\_\-1\_\-925V} to set the reference voltage to 1.925 V
\item {\bfseries COMP\_\-REF\_\-1\_\-959375V} to set the reference voltage to 1.959375 V
\item {\bfseries COMP\_\-REF\_\-2\_\-0625V} to set the reference voltage to 2.0625 V
\item {\bfseries COMP\_\-REF\_\-2\_\-165625V} to set the reference voltage to 2.165625 V
\item {\bfseries COMP\_\-REF\_\-2\_\-26875V} to set the reference voltage to 2.26875 V
\item {\bfseries COMP\_\-REF\_\-2\_\-371875V} to set the reference voltage to 2.371875 V
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
None. 
\end{DoxyReturn}
\hypertarget{group__comp__api_ga38adef6a943761121d8600e2570ed8c6}{
\index{comp\_\-api@{comp\_\-api}!ComparatorValueGet@{ComparatorValueGet}}
\index{ComparatorValueGet@{ComparatorValueGet}!comp_api@{comp\_\-api}}
\subsubsection[{ComparatorValueGet}]{\setlength{\rightskip}{0pt plus 5cm}tBoolean ComparatorValueGet (
\begin{DoxyParamCaption}
\item[{unsigned long}]{ ulBase, }
\item[{unsigned long}]{ ulComp}
\end{DoxyParamCaption}
)}}
\label{group__comp__api_ga38adef6a943761121d8600e2570ed8c6}
Gets the current comparator output value.


\begin{DoxyParams}{Parameters}
\item[{\em ulBase}]is the base address of the comparator module. \item[{\em ulComp}]is the index of the comparator.\end{DoxyParams}
This function retrieves the current value of the comparator output.

\begin{DoxyReturn}{Returns}
Returns {\bfseries true} if the comparator output is high and {\bfseries false} if the comparator output is low. 
\end{DoxyReturn}
